package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.PlanBlxx;
import com.indusfo.spc.service.PlanBlxxService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 熊冰
 * @Date: 2019/11/9 13:12
 * 任务单流程不良现象
 */

@Controller
@RequestMapping("/planBlxx")
public class PlanBlxxController {
	@Autowired
	private PlanBlxxService planBlxxService;

	//查询
	@RequestMapping(value="/queryPlanBlxx")
	@ResponseBody
	public JSONObject queryPlanBlxx(PlanBlxx planBlxx) {
		JSONObject json = planBlxxService.queryPlanBlxx(planBlxx);
		return json;
	}

	//新增
	@RequestMapping(value="/insertPlanBlxx", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject insertPlanBlxx(PlanBlxx planBlxx) {
		JSONObject json = planBlxxService.insertPlanBlxx(planBlxx);
		return json;
	}

	//修改
	@RequestMapping(value = "/updatePlanBlxx",method= RequestMethod.POST)
	@ResponseBody
	public JSONObject updatePlanBlxx (PlanBlxx planBlxx){
		JSONObject json=planBlxxService.updatePlanBlxx(planBlxx);
		return json;
	}

	//删除
	@RequestMapping(value="/deletePlanBlxx", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject deletePlanBlxx(@RequestParam("planBlxxIds") List<Integer> planBlxxIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planBlxxService.deletePlanBlxx(planBlxxIds, dataState);
		return json;
	}

	//启用
	@RequestMapping(value="/startPlanBlxx", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject startPlanBlxx(@RequestParam("planBlxxIds") List<Integer> planBlxxIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planBlxxService.deletePlanBlxx(planBlxxIds, dataState);
		return json;
	}

	//停用
	@RequestMapping(value="/stopPlanBlxx", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject stopPlanBlxx(@RequestParam("planBlxxIds") List<Integer> planBlxxIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planBlxxService.deletePlanBlxx(planBlxxIds, dataState);
		return json;
	}





}
